<%@page import="com.hamizhong.iflowers.utils.MyTools"%>
<%@page import="com.hamizhong.iflowers.utils.MyConstants"%>
<%@page import="com.hamizhong.iflowers.web.vo.AdminVO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@include file="../../common/common_admin.jsp" %>
<title>管理员信息管理</title>
</head>
<%
	AdminVO adminVO = (AdminVO)request.getAttribute("adminVO");
%>
<body>
	<div class="displayPageHeader">当前位置：个人管理 >> 修改口令</div>
	<div class="pageDiv">
		<div class="pageHeadDiv">管理员信息</div>
		<div class="infoDiv" style="padding-top: 20px;">
			<input type="text" id="adminId" style="display: none;" value="<%=adminVO.getAdminId() %>">
			<table cellpadding="2px">
				<tr>
					<td style="width: 100px;">&nbsp;&nbsp;管理员名称</td>
					<td>
						<font><%=adminVO.getLoginName()%></font>
					</td>
				</tr>
				<tr>
					<td style="width: 100px;">&nbsp;&nbsp;管理员类型</td>
					<td>
						<font><%=adminVO.getAdminTypeStr()%></font>
					</td>
				</tr>		
				<tr>
					<td style="width: 100px;">&nbsp;&nbsp;本次登录</td>
					<td><%=MyTools.formatDttm2YYYY_MM_DD_HH_MM_SS(adminVO.getThisLoginTime()) %></td>
				</tr>
				<tr>
					<td style="width: 100px;">&nbsp;&nbsp;上次登录</td>
					<td><%=MyTools.formatDttm2YYYY_MM_DD_HH_MM_SS(adminVO.getLastLoginTime()) %></td>
				</tr>
				<tr>
					<td style="width: 100px;">&nbsp;&nbsp;旧密码</td>
					<td>
						<input type="password" id="oldPassword">
					</td>
				</tr>
				<tr>
					<td style="width: 100px;">&nbsp;&nbsp;新密码</td>
					<td>
						<input type="password" id="newPassword">
					</td>
				</tr>
				<tr>
					<td style="width: 100px;">&nbsp;&nbsp;重复密码</td>
					<td>
						<input type="password" id="newPasswordRe">
					</td>
				</tr>
				<tr>
					<td style="width: 100px;"></td>
					<td>
						<input style="margin: 10px 0;" type="button" onclick="ajaxUpdateAdminPassword()" value="确认修改">
					</td>
				</tr>
			</table>
		</div>
		<div class="margin_5"></div>
	</div>
	<div class="margin_50"></div>
</body>

<script type="text/javascript">
	function ajaxUpdateAdminPassword() {
		var adminId = $('#adminId').val();
		var oldPassword = $('#oldPassword').val();
		var newPassword = $('#newPassword').val();
		var newPasswordRe = $('#newPasswordRe').val();
		if(oldPassword == '' || newPassword == '' || newPasswordRe == '') {
			alert("请填入相关密码修改信息！");
			return false;
		}
		$.ajax({
			url: '<%=request.getContextPath() %>/admin/admin/ajaxUpdateAdminPassword.action',
			data: {
				"adminId": adminId,
				"oldPassword": oldPassword,
				"newPassword": newPassword,
				"newPasswordRe": newPasswordRe
			},
			type: 'post',
			async: false,
			dataType: 'json',
			success: function(res) {
				var rs = res.result;
				if(rs != 0) {
					var msg = res.msg;
					alert(msg);
					return false;
				}else {
					alert("修改成功！");
					$('#oldPassword').val('');
					$('#newPassword').val('');
					$('#newPasswordRe').val('');
				}
			}
		});
	}
</script>

</html>